DefaultStatesMachine

class DefaultStatesMachine(statesManager: StatesManager, handlers: List<StateHandlerHolder<*>>) : StatesMachine

Default realization of StatesMachine. It uses statesManager for incapsulation of States storing and contexts resolving, and uses launchStateHandling for State handling

Constructors

DefaultStatesMachine
Link copied to clipboard
common
fun DefaultStatesMachine(statesManager: StatesManager, handlers: List<StateHandlerHolder<*>>)

Functions

handleState
Link copied to clipboard
common
open suspend override fun StatesMachine.handleState(state: State): State?

Will call launchStateHandling for state handling

start
Link copied to clipboard
common
open override fun start(scope: CoroutineScope): Job

Launch handling of states. On statesManager, statesManager will be called lambda with performing of state. If launchStateHandling will returns some State then statesManager will be used, otherwise StatesManager.endChain.

startChain
Link copied to clipboard
common
open suspend override fun startChain(state: State)

Just calls StatesManager.startChain of statesManager